package de.hska.algo.labor2010.strecken;

import java.util.ArrayList;
import java.util.List;
/**
 * This class can intersect several Lines provided in a List it returns a List of intersections of Type {@link Point}
 * @author Daniela
 *
 */
public class IntersectLinesBruteForce {
	/**
	 * 
	 * @param someLines List that holds at least two lines
	 * @return list of intersections of Type {@link Point}
	 */
	
	public List<Point> bruteForceIntersect(List<Line> someLines){
	
		List<Point> intersections = new ArrayList<Point>();
		int subListIndex = 0;
		for (Line line1 : someLines) {
			subListIndex ++;
			for (Line line2 : someLines.subList(subListIndex, someLines.size())) {
				Point intersection = line1.intersect(line2);
				if(intersection != null){
					intersections.add(intersection);
				}
			}
			
		}

		return intersections;
		
		
	}

}
